package com.ywu.bpmn.flow.api;

import com.ywu.bpmn.flow.dto.YwuFlowDefinitionDto;
import com.ywu.bpmn.flow.dto.YwuFlowDefinitionVersionDto;
import com.ywu.bpmn.flow.service.YwuFlowDefinitionVersionService;
import com.ywu.common.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName YwuFlowDefinitionVersionApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2025/4/22 17:10
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/bpmn/flow/version")
public class YwuFlowDefinitionVersionApi {
    @Autowired
    private YwuFlowDefinitionVersionService service;

    /**
     * @Author GroundDemo
     * @Description 查询流程版本列表
     * @Date 18:27 2025/4/22
     * @Param [dto]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/query.flow.version.list.info")
    public CommonResult<Object> queryVersionList(@RequestBody YwuFlowDefinitionDto dto) {
        return service.queryVersionList(dto);
    }

    /**
     * @Author GroundDemo
     * @Description 删除流程草稿版本
     * @Date 18:28 2025/4/22
     * @Param [dto]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/delete.flow.version.list.info")
    public CommonResult<Object> deleteVersion(@RequestBody YwuFlowDefinitionVersionDto dto) {
        return service.deleteVersion(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询历史版本数据
    * @Date 18:54 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.version.info")
    public CommonResult<Object> queryVersionInfo(@RequestBody YwuFlowDefinitionVersionDto dto) {
        return service.queryVersionInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询历史版本的流程表单
    * @Date 22:37 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.flow.form.version.info")
    public CommonResult<Object> queryFlowFormVersionInfo(@RequestBody YwuFlowDefinitionVersionDto dto) {
        return service.queryFlowFormVersionInfo(dto);
    }

    /**
     * @Author GroundDemo
     * @Description 回退流程历史版本
     * @Date 18:28 2025/4/22
     * @Param [dto]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/back.flow.version.list.info")
    public CommonResult<Object> backVersion(@RequestBody YwuFlowDefinitionVersionDto dto) {
        return service.backVersion(dto);
    }
}
